#encoding : utf-8

class CreateBlogs < ActiveRecord::Migration
  def change

    create_table :user_base_info, comment: '用户信息表' do |t|
      t.string :name, null:false, limit: 128, comment: '用户名称'
      t.string :password, null:false, limit: 10, comment: '用户密码'
      t.string :qq, limit: 128, comment: '用户QQ'
      t.string :email, limit: 128, comment: '用户邮箱'
    end

    create_table :blog, comment: '博客信息表' do |t|
      t.references :user_base_info
      t.string :title, null: false, limit: 128, comment: '博客标题'
      t.text :content, comment: '博客文章'
      t.string :status, null: false, default: 0, comment: ' 博客文章状态 0：正常， 1：冻结 ， 2：草稿 '
      t.string :publish_status, null: false, default: 0, comment: ' 博客文章状态 0：公开， 1：私有 '
      t.string :uid, null: false, comment: '用户id'
      t.string :tags_id, comment: '文章所属标签id'
      t.timestamps
    end

    create_table :tags, comment: '博客分类标签表' do |t|
      t.string :name, null: false, limit: 128, comment: '标签标题'
      t.timestamps
    end

    create_table :comment, comment: '博客评论表' do |t|
      t.string :blog_id, null: false, limit: 128, comment: '博客id'
      t.text   :content, comment: '评论'
      t.string :reply_times, null: false, default: 0, comment: ' 博客文章回复数 默认0回复 '
      t.string :visit_times, null: false, default: 0, comment: ' 博客文章浏览数 默认0浏览 '
      t.timestamps
    end
  end
end
